class Question
  include MongoMapper::Document
  key :body, String
  key :choices, Array
  key :correct_choices, Array

  def self.random
    question_count = Question.count
    return nil if question_count == 0
    # FIXME! How do we get back the Model object directly
    # (without needing the second find() call)
    json_obj = collection.find().limit(1).skip(rand(question_count)).first
    Question.find(json_obj['_id'])
  end
end










